#! /bin/awk -f
# Author : Raman Rawat
# Launch command as 
#awk -v r="{$sedArg}" -f ReplaceTextInFile.awk $1
# FileList.txt has path of files to be analysed.


BEGIN {
}
{ 

#print "length of " $1 "is" length($1) 
if( length($1) > 0) {

    # create the sed command for each entry
    x="sed " r " "$1" > "$1".tmp"
    print "sedCmd =" x
    system(x)
        
    # make the new file name
    #z=$0
    #gsub(r, Replacement, z)
    #print "z =" z
    ## move the file back to the original name.
    x="mv "$1".tmp " $1
    #print x
    system(x)

}
    
}
